import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

import path from "path";
// https://vite.dev/config/
export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
      "@/utils": path.resolve(__dirname, "./src/utils"),
    },
  },
  server:{
    proxy:{
      '/api':{
        target:'http://localhost:8080',
        changeOrigin:true,//是否修改请求头中的origin
        rewrite:(path)=>path.replace(/^\/api/,'')//重写请求路径
      }
    }
  }
});
